﻿using AbpEntityFrameworkcore.DbContext;
using AbpToDomain.View;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AbpApplication.Expand
{
    public class QueryDynamic_View_Inlethouseline
    {


        private readonly MyDbContext context;

        public QueryDynamic_View_Inlethouseline(MyDbContext context)
        {
            this.context = context;
        }
        public List<View_InlethouseLine> QueryDynameic(string? InlethouseCode,
        int? Xaxis, int? Yaxis, int? Zaxis,string Type)
        {
            IQueryable<View_InlethouseLine>View_Inlethouselines = context.View_InlethouseLines;
            if (!string.IsNullOrEmpty(InlethouseCode))
            {
                View_Inlethouselines = View_Inlethouselines.Where(b => b.InlethouseLineCode.Contains(InlethouseCode));
            }
            if (!string.IsNullOrEmpty(Xaxis.ToString()))
            {
                View_Inlethouselines = View_Inlethouselines.Where(b => b.Xaxis==Xaxis);
            }
            if (!string.IsNullOrEmpty(Yaxis.ToString()))
            {
                View_Inlethouselines = View_Inlethouselines.Where(b => b.Yaxis == Yaxis);
            }
            if (!string.IsNullOrEmpty(Zaxis.ToString()))
            {
                View_Inlethouselines = View_Inlethouselines.Where(b => b.Zaxis == Zaxis);
            }
            if (!string.IsNullOrEmpty(Type))
            {
                View_Inlethouselines = View_Inlethouselines.Where(b => b.Type.Contains(Type));
            }

            return View_Inlethouselines.ToList();
        }

    }
}
